$(function () {

});

function searchData() {

   /* if(!($("#username").val() != '谭燕芳'&& $("#identity").val() != '440224198405032060'&&
            $("#username").val() != ''&& $("#identity").val() != ''
        )){
        layer.msg('未找到相关数据');
        return;
    }*/
    var table = layui.table, layer = layui.layer;

    table.init('serviceTable',{
        data: [
            {
                id:1,
                "CXJBYLBXGRJFDCHMQLQYLJS": "0",
                "CYBGYY": "正常",
                "BGSJ": "",
                "JYYQ": "无",
                "SFSC": "否",
                "WGSC": "12",
                "ZZMM": "群众",
                "JSYY": "",
                "SFCJCZZGJBYLBX": "否",
                "JYYX": "无",
                "CYWYID": "327335",
                "JKZK": "健康",
                "NDNL": "劳动力",
                "CJZ": "",
                "SFCJCZJMJBYLBX": "否",
                "YHZGX": "户主",
                "ZJLX": "",
                "JNZK": "无",
                "SFGE": "否",
                "SFYHJ": "有户籍",
                "WHCD": "初中",
                "ZXSZK": "非在校",
                "ZLSJ": "2018-12-02 03:20:29",
                "PXXQ": "无",
                "JBLX": "",
                "SFZ": "440224198405032060",
                "SFXSDB": "否",
                "SSH": "138923",
                "WGZK": "县内务工",
                "ZLBS": "I",
                "EDJGYXYY": "无意愿",
                "XB": "女",
                "GMSFZH": "440224198405032060",
                "MZ": "汉族",
                "SFCJCXJMJBYLBX": "是",
                "CSRQ": "1984-05-03",
                "SJRQ": "20181201",
                "XZSJ": "2018-12-02 03:20:29",
                "ZJ": "24900",
                "PCH": "2018120200001",
                "XM": "谭燕芳",
                "SFCJDBYLBX": "",
                "SFXYJR": "否",
                "ZJYY": "",
                "SFXSWB": "否",
                "LRSJ": ""
            }

        ]
        , toolbar: true
        , title: '贫困户家庭成员信息'
        , page: true
    });

    //监听行工具事件
    table.on('tool(serviceTable)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值

        if (layEvent === 'detail') {
            loadDetail(data.id)
        }
    });
}

function loadDetail(id) {
    var data = [
        {
            id:1,
            "CXJBYLBXGRJFDCHMQLQYLJS": "0",
            "CYBGYY": "正常",
            "BGSJ": "",
            "JYYQ": "无",
            "SFSC": "否",
            "WGSC": "无",
            "ZZMM": "群众",
            "JSYY": "",
            "SFCJCZZGJBYLBX": "否",
            "JYYX": "无",
            "CYWYID": "327335",
            "JKZK": "健康",
            "NDNL": "劳动力",
            "CJZ": "",
            "SFCJCZJMJBYLBX": "否",
            "YHZGX": "户主",
            "ZJLX": "",
            "JNZK": "无",
            "SFGE": "否",
            "SFYHJ": "有户籍",
            "WHCD": "初中",
            "ZXSZK": "非在校",
            "ZLSJ": "2018-12-02 03:20:29",
            "PXXQ": "无",
            "JBLX": "",
            "SFZ": "440224198405032060",
            "SFXSDB": "否",
            "SSH": "138923",
            "WGZK": "县内务工",
            "ZLBS": "I",
            "EDJGYXYY": "无意愿",
            "XB": "女",
            "GMSFZH": "440224198405032060",
            "MZ": "汉族",
            "SFCJCXJMJBYLBX": "是",
            "CSRQ": "1984-05-03",
            "SJRQ": "20181201",
            "XZSJ": "2018-12-02 03:20:29",
            "ZJ": "24900",
            "PCH": "2018120200001",
            "XM": "谭燕芳",
            "SFCJDBYLBX": "",
            "SFXYJR": "否",
            "ZJYY": "",
            "SFXSWB": "否",
            "LRSJ": ""
        },
        {
            id:2,
            "CXJBYLBXGRJFDCHMQLQYLJS": "0",
            "CYBGYY": "正常",
            "BGSJ": "",
            "JYYQ": "无",
            "SFSC": "否",
            "WGSC": "无",
            "ZZMM": "群众",
            "JSYY": "",
            "SFCJCZZGJBYLBX": "否",
            "JYYX": "无",
            "CYWYID": "327335",
            "JKZK": "健康",
            "NDNL": "劳动力",
            "CJZ": "",
            "SFCJCZJMJBYLBX": "否",
            "YHZGX": "母女",
            "ZJLX": "",
            "JNZK": "无",
            "SFGE": "否",
            "SFYHJ": "有户籍",
            "WHCD": "小学",
            "ZXSZK": "在校",
            "ZLSJ": "2018-10-02 03:20:00",
            "PXXQ": "无",
            "JBLX": "",
            "SFZ": "440341********2341",
            "SFXSDB": "否",
            "SSH": "138923",
            "WGZK": "无",
            "ZLBS": "I",
            "EDJGYXYY": "无意愿",
            "XB": "女",
            "GMSFZH": "440341********2341",
            "MZ": "汉族",
            "SFCJCXJMJBYLBX": "是",
            "CSRQ": "2008-11-13",
            "SJRQ": "20181001",
            "XZSJ": "2018-10-02 03:20:00",
            "ZJ": "24900",
            "PCH": "2018100200001",
            "XM": "李冬玲",
            "SFCJDBYLBX": "",
            "SFXYJR": "否",
            "ZJYY": "",
            "SFXSWB": "否",
            "LRSJ": ""
        }
    ];


    var data0 = data[parseInt(id) - 1];

    $('#detailD').html(template('detailDS',{data:data0}))
    layer.open({
        type: 1,
        content: $("#detail"),
        area: ['900px', '550px'],
        title: '贫困户家庭成员信息详情',
        maxmin: true,
        shade: 0,
        cancel: function () {
            $("#detail").hide()
        }
    });


}